<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: zhuzonghui
  Date: 2022/4/20
  Time: 上午12:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>后台管理</title>
</head>
<body>
<div>
    <center>
        <div>
            <div><h2>${title}</h2></div>
            <div><h6>欢迎您，${tUser.usernick}，您的权限为: ${tUser.userPermssionName}</h6></div>
            <div>
                <div>
                    <table>
                        <tr>
                            <c:if test="${tUser.userPermssionId==1}">
                                <th>
                                    <button onclick="changeWelcomeText()">首页文字更改</button>
                                </th>
                                <th>
                                    <button onclick="schoolAdmin()">学校管理</button>
                                </th>
                            </c:if>
                            <c:if test="${tUser.userPermssionId<=2}">
                                <th>
                                    <button onclick="collageAdmin()">院系管理</button>
                                </th>
                            </c:if>
                            <c:if test="${tUser.userPermssionId<=3}">
                                <th>
                                    <button onclick="classAdmin()">班级管理</button>
                                </th>
                            </c:if>
                            <c:if test="${tUser.userPermssionId<=4}">
                                <th>
                                    <button onclick="userAdmin()">用户管理</button>
                                </th>
                                <th>
                                    <button>分数管理</button>
                                </th>
                            </c:if>
                            <th>
                                <button>查看分数</button>
                            </th>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </center>
</div>
</body>
<script type="text/javascript">
    function changeWelcomeText() {
        window.location.href = "${url}" + "/welcome/change"
    }

    function schoolAdmin() {
        window.location.href = "${url}" + "/school/admin"
    }

    function collageAdmin() {
        window.location.href = "${url}" + "/collage/admin?token=" + sessionStorage.getItem("token")
    }

    function classAdmin() {
        window.location.href = "${url}" + "/class/admin?token=" + sessionStorage.getItem("token")
    }

    function userAdmin() {
        window.location.href = "${url}" + "/user/admin?token=" + sessionStorage.getItem("token")
    }
</script>
</html>
